package com.qingcloud.adminbackend.controller;


import com.qingcloud.adminbackend.base.AjaxResult;
import com.qingcloud.adminbackend.constant.WamingConstant;
import com.qingcloud.adminbackend.entity.robot.RobotInfo;
import com.qingcloud.adminbackend.service.IRobotService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 机器人
 * </p>
 *
 * @author zhoujun
 * @since 2021-10-23
 */
@RestController
@RequestMapping("/sys-robot")
public class SysRobotController {

    @Resource
    private IRobotService robotService;


    @ApiOperation(value = "保存机器人设备信息", notes = "保存机器人设备信息")
    @PostMapping("/saveRobotInfo")
    public AjaxResult saveRobotInfo(@RequestBody RobotInfo robotInfo) {
        int info=robotService.saveRobotInfo(robotInfo);
        if(info==-1){

        }
        return new AjaxResult(WamingConstant.SUCCESS, "", robotService.saveRobotInfo(robotInfo));
    }

    @ApiOperation(value = "查询机器人配置", notes = "保存机器人设备信息")
    @GetMapping("/queryRobotInfo")
    public AjaxResult queryRobotInfo(@RequestParam("serialNumber") String serialNumber) {
        return new AjaxResult(WamingConstant.SUCCESS, "", robotService.robotProject(serialNumber));
    }
}
